from tkinter import Tk, Canvas, Frame, BOTH
 
 
class Example(Frame):
 
    def __init__(self):
        super().__init__()
        self.initUI()
 
    def initUI(self):
        self.master.title("Рисуем линии")
        self.pack(fill=BOTH, expand=1)
 
        canvas = Canvas(self)
        
        # canvas.create_line(15, 25, 200, 25)
        
        def fractal_rectangle(deep=10):
            if deep < 1:
                return

                points = [
                        150, 100, 200, 120, 240, 180, 210,
                        200, 150, 150, 100, 200
                        ]

                canvas.create_polygon(points)

        fractal_rectangle()
 
        canvas.pack(fill=BOTH, expand=1)
 
 
def main():
    root = Tk()
    ex = Example()
    root.geometry("400x250+300+300")
    root.mainloop()
 
 
if __name__ == '__main__':
    main()
